<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>lineargradient.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_graphics_lineargradient.js.html">lineargradient.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2007 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>
<a name="line16"></a>/**
<a name="line17"></a> * @fileoverview Represents a gradient to be used with a Graphics implementor.
<a name="line18"></a> * @author arv@google.com (Erik Arvidsson)
<a name="line19"></a> */
<a name="line20"></a>
<a name="line21"></a>
<a name="line22"></a>goog.provide(&#39;goog.graphics.LinearGradient&#39;);
<a name="line23"></a>
<a name="line24"></a>
<a name="line25"></a>goog.require(&#39;goog.asserts&#39;);
<a name="line26"></a>goog.require(&#39;goog.graphics.Fill&#39;);
<a name="line27"></a>
<a name="line28"></a>
<a name="line29"></a>
<a name="line30"></a>/**
<a name="line31"></a> * Creates an immutable linear gradient fill object.
<a name="line32"></a> *
<a name="line33"></a> * @param {number} x1 Start X position of the gradient.
<a name="line34"></a> * @param {number} y1 Start Y position of the gradient.
<a name="line35"></a> * @param {number} x2 End X position of the gradient.
<a name="line36"></a> * @param {number} y2 End Y position of the gradient.
<a name="line37"></a> * @param {string} color1 Start color of the gradient.
<a name="line38"></a> * @param {string} color2 End color of the gradient.
<a name="line39"></a> * @param {?number=} opt_opacity1 Start opacity of the gradient, both or neither
<a name="line40"></a> *     of opt_opacity1 and opt_opacity2 have to be set.
<a name="line41"></a> * @param {?number=} opt_opacity2 End opacity of the gradient.
<a name="line42"></a> * @constructor
<a name="line43"></a> * @extends {goog.graphics.Fill}
<a name="line44"></a> */
<a name="line45"></a>goog.graphics.LinearGradient =
<a name="line46"></a>    function(x1, y1, x2, y2, color1, color2, opt_opacity1, opt_opacity2) {
<a name="line47"></a>  /**
<a name="line48"></a>   * Start X position of the gradient.
<a name="line49"></a>   * @type {number}
<a name="line50"></a>   * @private
<a name="line51"></a>   */
<a name="line52"></a>  this.x1_ = x1;
<a name="line53"></a>
<a name="line54"></a>  /**
<a name="line55"></a>   * Start Y position of the gradient.
<a name="line56"></a>   * @type {number}
<a name="line57"></a>   * @private
<a name="line58"></a>   */
<a name="line59"></a>  this.y1_ = y1;
<a name="line60"></a>
<a name="line61"></a>  /**
<a name="line62"></a>   * End X position of the gradient.
<a name="line63"></a>   * @type {number}
<a name="line64"></a>   * @private
<a name="line65"></a>   */
<a name="line66"></a>  this.x2_ = x2;
<a name="line67"></a>
<a name="line68"></a>  /**
<a name="line69"></a>   * End Y position of the gradient.
<a name="line70"></a>   * @type {number}
<a name="line71"></a>   * @private
<a name="line72"></a>   */
<a name="line73"></a>  this.y2_ = y2;
<a name="line74"></a>
<a name="line75"></a>  /**
<a name="line76"></a>   * Start color of the gradient.
<a name="line77"></a>   * @type {string}
<a name="line78"></a>   * @private
<a name="line79"></a>   */
<a name="line80"></a>  this.color1_ = color1;
<a name="line81"></a>
<a name="line82"></a>  /**
<a name="line83"></a>   * End color of the gradient.
<a name="line84"></a>   * @type {string}
<a name="line85"></a>   * @private
<a name="line86"></a>   */
<a name="line87"></a>  this.color2_ = color2;
<a name="line88"></a>
<a name="line89"></a>  goog.asserts.assert(
<a name="line90"></a>      goog.isNumber(opt_opacity1) == goog.isNumber(opt_opacity2),
<a name="line91"></a>      &#39;Both or neither of opt_opacity1 and opt_opacity2 have to be set.&#39;);
<a name="line92"></a>
<a name="line93"></a>  /**
<a name="line94"></a>   * Start opacity of the gradient.
<a name="line95"></a>   * @type {?number}
<a name="line96"></a>   * @private
<a name="line97"></a>   */
<a name="line98"></a>  this.opacity1_ = goog.isDef(opt_opacity1) ? opt_opacity1 : null;
<a name="line99"></a>
<a name="line100"></a>  /**
<a name="line101"></a>   * End opacity of the gradient.
<a name="line102"></a>   * @type {?number}
<a name="line103"></a>   * @private
<a name="line104"></a>   */
<a name="line105"></a>  this.opacity2_ = goog.isDef(opt_opacity2) ? opt_opacity2 : null;
<a name="line106"></a>};
<a name="line107"></a>goog.inherits(goog.graphics.LinearGradient, goog.graphics.Fill);
<a name="line108"></a>
<a name="line109"></a>
<a name="line110"></a>/**
<a name="line111"></a> * @return {number} The start X position of the gradient.
<a name="line112"></a> */
<a name="line113"></a>goog.graphics.LinearGradient.prototype.getX1 = function() {
<a name="line114"></a>  return this.x1_;
<a name="line115"></a>};
<a name="line116"></a>
<a name="line117"></a>
<a name="line118"></a>/**
<a name="line119"></a> * @return {number} The start Y position of the gradient.
<a name="line120"></a> */
<a name="line121"></a>goog.graphics.LinearGradient.prototype.getY1 = function() {
<a name="line122"></a>  return this.y1_;
<a name="line123"></a>};
<a name="line124"></a>
<a name="line125"></a>
<a name="line126"></a>/**
<a name="line127"></a> * @return {number} The end X position of the gradient.
<a name="line128"></a> */
<a name="line129"></a>goog.graphics.LinearGradient.prototype.getX2 = function() {
<a name="line130"></a>  return this.x2_;
<a name="line131"></a>};
<a name="line132"></a>
<a name="line133"></a>
<a name="line134"></a>/**
<a name="line135"></a> * @return {number} The end Y position of the gradient.
<a name="line136"></a> */
<a name="line137"></a>goog.graphics.LinearGradient.prototype.getY2 = function() {
<a name="line138"></a>  return this.y2_;
<a name="line139"></a>};
<a name="line140"></a>
<a name="line141"></a>
<a name="line142"></a>/**
<a name="line143"></a> * @return {string} The start color of the gradient.
<a name="line144"></a> */
<a name="line145"></a>goog.graphics.LinearGradient.prototype.getColor1 = function() {
<a name="line146"></a>  return this.color1_;
<a name="line147"></a>};
<a name="line148"></a>
<a name="line149"></a>
<a name="line150"></a>/**
<a name="line151"></a> * @return {string} The end color of the gradient.
<a name="line152"></a> */
<a name="line153"></a>goog.graphics.LinearGradient.prototype.getColor2 = function() {
<a name="line154"></a>  return this.color2_;
<a name="line155"></a>};
<a name="line156"></a>
<a name="line157"></a>
<a name="line158"></a>/**
<a name="line159"></a> * @return {?number} The start opacity of the gradient.
<a name="line160"></a> */
<a name="line161"></a>goog.graphics.LinearGradient.prototype.getOpacity1 = function() {
<a name="line162"></a>  return this.opacity1_;
<a name="line163"></a>};
<a name="line164"></a>
<a name="line165"></a>
<a name="line166"></a>/**
<a name="line167"></a> * @return {?number} The end opacity of the gradient.
<a name="line168"></a> */
<a name="line169"></a>goog.graphics.LinearGradient.prototype.getOpacity2 = function() {
<a name="line170"></a>  return this.opacity2_;
<a name="line171"></a>};
</pre>


</body>
</html>
